package com.food.controller;


import com.food.configure.Result;
import com.food.entity.Material;
import com.food.service.MaterialService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author
 * @since 2021-04-04
 */
@RestController
@RequestMapping("/material")
public class MaterialController {

    @Autowired
    MaterialService materialService;

    /**
     * 添加/修改--材料信息
     */
    @RequestMapping("/updateMaterial")
    public Result<Material> updateMaterial(@RequestBody Material material) {
        return materialService.updateMaterial(material);
    }

    /**
     * 删除--材料信息
     */
    @RequestMapping("/delMaterial")
    public Result<Material> delMaterial(@RequestBody Material material) {
        return materialService.delMaterial(material);
    }

    /**
     * 批量删除
     */
    @RequestMapping("/batchDelMaterial")
    public Result<Material> batchDelMaterial(@RequestBody Material material) {
        return materialService.batchDelMaterial(material);
    }

    /**
     * 查询(不分页)--下拉栏
     */
    @RequestMapping("/queryMaterial")
    public Result<Material> queryMaterial(@RequestBody Material material) {
        return materialService.queryMaterial(material);
    }

    /**
     * 查询(分页)--查询食材
     */
    @RequestMapping("/queryMaterialByPage")
    public Result<Material> queryMaterialByPage(@RequestBody Material material) {
        return materialService.queryMaterialByPage(material);
    }

    /**
     * 根据ID查询
     */
    @RequestMapping("/queryMaterialById")
    public Result<Material> queryMaterialById(@RequestBody Material material) {
        return materialService.queryMaterialById(material);
    }

}

